<template>
  <div>
    <div>
      <z-table
          :page-param="pageParam"
          :tableColumns="tableColumns"
          :table-data="tableData"
      />
    </div>
  </div>
</template>
<script>
import {page} from '@/api/auth/system';

export default {
  name: 'application',
  data() {
    return {
      pageParam: {
        current: 1,
        size: 20,
        total: 0,
      },
      tableData: [],
      tableColumns: [
        {prop: 'name', label: '应用名称', minWidth: '180'},
        {prop: 'code', label: '应用代码', minWidth: '180'},
        {prop: 'createAt', label: '创建时间', minWidth: '180'}
      ],
    }
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      this.initTable();
    },
    initTable() {
      const param = {...this.pageParam}
      page(param).then(({code, data}) => {
        if (code === 200) {
          console.log(data.records);
          this.tableData = data.records;
          this.pageParam.total = data.total;
        }
      })
    }
  },
}
</script>
